<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"/>
    <title>市场中心</title>
    <link rel="stylesheet" href="../css/base.css"/>
    <link rel="stylesheet" href="../css/header.css"/>
    <link rel="stylesheet" href="../css/my_market.css"/>
    <style>
        .list ul li .goods .img_box{
            width: 1.5rem;
            height: 1.5rem;
        }
    </style>
</head>
<body>
<div class="layer">
    <header>
        <i onclick="location.href='./local_market.html'"></i>
        <h3>市场中心</h3>
    </header>
    <div class="nav clearfix">
        <ul class="clearfix">
            <li>
                <a href="./my_market.html" >出售中</a>
            </li>
            <li>
                <a href="./my_market_published.html"  class="active">已发布</a>
            </li>
            <li>
                <a href="./my_market_order.html">全部订单</a>
            </li>
            <li>
                <a href="./my_market_save.html">收藏</a>
            </li>
            <li>
                <a href="./my_market_pay.html">佣金</a>
            </li>
        </ul>
    </div>
    <div class="list">
        <ul class="clearfix">
            <!--tianc-->
        </ul>
    </div>
</div>
</body>
<script src="../js/x_rem.js"></script>
<script src="../js/base.js"></script>
<script src="../js/jquery.js"></script>
<script src="../js/template-web.js"></script>
<script id="list" type="text/html">
    {{if list.length==0}}
    <li class="no_order"> 对不起，您暂时没有发布任何商品！</li>
    {{else}}
    {{each list as value i}}
    {{if value.goodsNumber<1||value.goodsNumber==null}}
    {{if value.status==0}}
    <li>
        <div class="goods">
            {{if value.images.length==0}}
            <img src="../img/no_photo.png" alt=""/>
            {{else}}
            <img src="{{value.images[0].path}}" alt=""/>
            {{/if}}
            <div class="center">
                <span>{{value.introduction}}</span>
                <!--<em>10次预览 &nbsp;&nbsp; <del>2个留言</del></em>-->
                <i>￥{{value.price}}&nbsp;&nbsp; </i>
                <!--<s>原价￥{{value.price}}</s>-->
            </div>
        </div>
        <div class="handle">
            <button class="send_out" data-index="">确定发货</button>
        </div>
    </li>
    {{else}}
    <li>
        <div class="goods">
            <div class="img_box">
                <img src="../img/focus-img1.png" alt=""/>
            </div>
            <div class="center">
                <span>夏日斜跨小包包女2018新款潮韩版百搭时尚夏日斜跨小包包女2尚夏日斜跨小包包女2尚夏日斜跨小包包女2尚夏日斜跨小包包女2018新款潮韩版百搭时尚</span>
                <em>10次预览 &nbsp;&nbsp; <del>2个留言</del></em>
                <i>￥15&nbsp;&nbsp; <s>原价90</s></i>
            </div>
        </div>
        <div class="handle">
            <button class="sold_out">下架</button>
            <button class="delete">发布成功</button>
        </div>
    </li>
    {{/if}}
    {{/if}}
    {{/each}}
    {{/if}}
</script>
<script >
    render();
        function render(){
            ///goods/selectMyGoodsTo  查看我发布的
            $.ajax({
                //处理session每次不唯一问题
                xhrFields: {
                    withCredentials: true
                },
                async:false,
                type: "post",
                url: baseUrl+"/goods/selectMyGoodsTo",
                data:{

                },
                dataType: 'json',
                success:function(data) {
                    console.log(data);
                    if(data.code=="success"||data.state==true||data.list!=="网络出了点小问题...."){
                        $(".list>ul").html(template("list",data))
                    }else{
                       alert("网络错误，请您稍后重试");
                        location.href='./login.html';
                    }

                }

            })
        }
</script>
</html>